// HTTP异常类型枚举
enum HttpExceptionTypeEnum {
    noPermission = 0,
    serviceException = 1,
    timeOut = 2,
    badRequest = 3,
    requestFailed = 4
}

// HTTP异常类型枚举成员
const httpExceptionTypeMembers:Map<HttpExceptionTypeEnum, string> = new Map<HttpExceptionTypeEnum, string>()
httpExceptionTypeMembers.set(HttpExceptionTypeEnum.noPermission, '身份失效')
httpExceptionTypeMembers.set(HttpExceptionTypeEnum.serviceException, '服务器内部错误')
httpExceptionTypeMembers.set(HttpExceptionTypeEnum.timeOut, '请求超时')
httpExceptionTypeMembers.set(HttpExceptionTypeEnum.badRequest, '请求地址错误')
httpExceptionTypeMembers.set(HttpExceptionTypeEnum.requestFailed, '请求失败')

/**
 * HTTP异常类型枚举转换器
 * @param value 值
 * */
function httpExceptionTypeConvert(value:HttpExceptionTypeEnum):string {
    const result:string = httpExceptionTypeMembers.has(value) ? httpExceptionTypeMembers.get(value)! : ''
    return result
}

export {
    HttpExceptionTypeEnum,
    httpExceptionTypeMembers,
    httpExceptionTypeConvert
}
